<!--Gordana Pejic 191/01-->
<?php
    require_once dirname(__FILE__). '/db.php';
    require_once dirname(__FILE__). '/con_feedback_star.php';
    
    $con = dbConnect("sib");

    $hid=$_GET["hid"];
    $sql = "SELECT * FROM feedback WHERE IDHostel = '$hid'";
    $result=mysql_query($sql, $con);

    function writeFeedStars($idf){

        // napisati fju za ispis zvezdica za pojedinacni feedback!
    }

       $sql_hostel="SELECT * FROM hostel WHERE IDHostel='$hid'";

       $result_hostel=mysql_query($sql_hostel, $con) or die (mysql_error());

       $row_hostel=mysql_fetch_array($result_hostel);
       echo '<h2>'.$row_hostel["Name"].'</h2>';

     while ($row = mysql_fetch_array($result)) {
            $idf = $row["IDFeedback"];
            $idu=$row["IDUser"];
            $desc=$row["Text"];
            $date=$row["DateTime"];
            $security=$row["Security"];
            $location=$row["Location"];
            $service=$row["Service"];
            $fun=$row["Fun"];
            $clean=$row["Cleanliness"];
            $price=$row["Price"];
            $recommend=$row["Recommend"];

            $sql_user="SELECT * FROM user WHERE IDUser='$idu'";

            $result_user=mysql_query($sql_user, $con) or die (mysql_error());
            
            $row_user=mysql_fetch_array($result_user);
            
            echo '<div class="onefeedback">
		<div class="title"><h3>' . $row_user["UserName"] . '</h3></div>
                    <div class="entry">' . $desc . '</div>'.'

                    <div class="hostel_stars">';


            printFeedbackStars($row_user["IDUser"]);

                    
            echo      '  </div>
	   </div>';
        }

    mysql_close($con);
?>
